home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
User's Choice Windows CD
/
User's Choice Windows CD (CMS Software)(1993).iso
/
win_q_t
/
trem.zip
/
FOCUS.C
< prev
next >
Wrap
Text File
|
1991-05-11
|
3KB
|
91 lines
/************************************************************************
*
* Copyright (c) 1991 Microsoft Corporation. All Rights Reserved.
*
*-----------------------------------------------------------------------
*
* Project: Windows Terminal Example
*
* Module: focus.c
*
* Author: Bryan A. Woodruff (baw)
*
*
* Remarks: Handles the focus (caret creation, destruction)
*
* Revisions:
* 01.00.000 5/ 9/91 baw Wrote it.
*
************************************************************************/
#include "terminal.h"
/************************************************************************
* BOOL SetTerminalFocus( HWND hWnd )
*
* Description:
* Sets the focus to the terminal window also creates caret.
*
* Comments:
* 5/ 9/91 baw Wrote it.
*
************************************************************************/
BOOL SetTerminalFocus( HWND hWnd )
{
LOCALHANDLE hTermInfo ;
NPTERMINFO npTermInfo ;
hTermInfo = GetWindowWord( hWnd, GWW_TERMINFO ) ;
if (NULL == (npTermInfo = (NPTERMINFO) LocalLock( hTermInfo )))
return ( FALSE ) ;
if (npTermInfo -> fConnected && (npTermInfo -> wCursorState != CS_SHOW))
{
CreateCaret( hWnd, NULL, npTermInfo -> xChar, npTermInfo -> yChar ) ;
ShowCaret( hWnd ) ;
npTermInfo -> wCursorState = CS_SHOW ;
}
MoveTerminalCursor( hWnd ) ;
LocalUnlock( hTermInfo ) ;
return ( TRUE ) ;
} /* end of SetTerminalFocus() */
/************************************************************************
* BOOL KillTerminalFocus( HWND hWnd )
*
* Description:
* Kills terminal focus.
*
* Comments:
* 5/ 9/ 91 baw Wrote it.
*
************************************************************************/
BOOL KillTerminalFocus( HWND hWnd )
{
LOCALHANDLE hTermInfo ;
NPTERMINFO npTermInfo ;
hTermInfo = GetWindowWord( hWnd, GWW_TERMINFO ) ;
if (NULL == (npTermInfo = (NPTERMINFO) LocalLock( hTermInfo )))
return ( FALSE ) ;
if (npTermInfo -> fConnected && (npTermInfo -> wCursorState != CS_HIDE))
{
HideCaret( hWnd ) ;
DestroyCaret() ;
npTermInfo -> wCursorState = CS_HIDE ;
}
LocalUnlock( hTermInfo ) ;
return ( TRUE ) ;
} /* end of KillTerminalFocus() */
/************************************************************************
* End of File: focus.c
************************************************************************/